#include "enginedirs.h"

#include <sstream>
#include <string>

#include <cstdlib>
#include <cstring>

namespace Lame3d
{
	char *userDir = NULL;
	char *systemDir = NULL;
	
	const char* getUserDir()
	{
		if(userDir == NULL) {
			std::string tmp;
			std::stringstream ss;
			ss << getenv("HOME") << DIRSEP << APPDIR;
			ss >> tmp;
			userDir = new char[strlen(tmp.c_str())];
			strcpy(userDir, tmp.c_str());
		}
		return userDir;
	}
	
	const char* getSystemDir()
	{
		if(systemDir == NULL) {
			systemDir = ".";
		}
		return systemDir;
	}
}
